/**
 * Created by liguangsong on 16/8/2.
 */
import { SEARCH_CHANGE, CLEAN_FILTER } from '../action/index.js'

function initialState() {
    return {
        filter: null
    }
}

function searchChange(state = initialState(), action) {
    switch (action.type) {
        case SEARCH_CHANGE: {
            var filter = {
                name: action.filter.name,
                team: action.filter.team,
                id: action.filter.id
            };
            return {
                filter
            }

        }
        case CLEAN_FILTER: {
            return {
                filter: null
            }
        }

        default : {
            return state;
        }
    }
}

export default searchChange;